home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-1.iso / program / swmp141.zip / ASM_SDK.ZIP / EXAMPLE.ASM next >
Assembly Source File  |  1995-12-12  |  2KB  |  65 lines

  1. INCLUDE         MODPLAY.INC
  2.  
  3.                 .286
  4.                 .SEQ
  5.                 .MODEL SMALL
  6.                 .STACK 200h
  7.  
  8.                 .DATA
  9. PSP             DW      0
  10. Error_1         DB      'Cannot initialize sound driver...',13,10,'$'
  11. Error_2         DB      'Unable to load module file...',13,10,'$'
  12. Message         DB      'Playing module... Press [ESC] to quit.$'
  13. Filename        DB      'INTROII.MOD',0
  14.  
  15.                 .CODE
  16.                 LOCALS
  17. Start:          mov     ax,SEG _DATA
  18.                 mov     ds,ax
  19.                 mov     [PSP],es
  20.                 xor     bx,bx
  21.                 xor     ax,ax
  22.                 call    FAR PTR Mod_Driver      ; Detection & Initialization
  23.                 or      ax,ax
  24.                 jnz     @@1
  25.                 mov     dx,OFFSET Error_1
  26.                 call    DOS_Text
  27.                 jmp     SHORT Terminate
  28. @@1:            call    FAR PTR [Mod_End_Seg]   ; returns: ax=end segment
  29.                 mov     bx,ax
  30.                 mov     ax,[PSP]
  31.                 mov     es,ax
  32.                 sub     bx,ax                   ; bx=prog length in paragraphs
  33.                 mov     ah,4Ah
  34.                 int     21h                     ; set memory control block
  35.                 mov     bx,2
  36.                 mov     dx,OFFSET Filename
  37.                 call    FAR PTR Mod_Driver      ; load module in ds:dx
  38.                 or      ax,ax
  39.                 jnz     @@2
  40.                 mov     dx,OFFSET Error_2
  41.                 call    DOS_Text
  42.                 jmp     SHORT CloseDriver
  43. @@2:            mov     bx,3
  44.                 mov     ax,1
  45.                 call    FAR PTR Mod_Driver      ; start playing, looping is on
  46.                 mov     dx,OFFSET Message
  47.                 call    DOS_Text
  48. @@3:            mov     ah,1
  49.                 int     16h
  50.                 jz      @@3                     ; wait for keystroke
  51.                 xor     ah,ah
  52.                 int     16h                     ; test for escape key
  53.                 cmp     al,1Bh
  54.                 jnz     @@3
  55. CloseDriver:    mov     bx,1
  56.                 call    FAR PTR Mod_Driver
  57. Terminate:      mov     ax,4C00h
  58.                 int     21h
  59.  
  60. DOS_Text:       mov     ah,9
  61.                 int     21h
  62.                 ret
  63.  
  64. END             Start
  65.